let data = {
  name: "后盾人",
  user: {
    name: "hdcms"
  },
  arr: []
};
function copy(obj) {
  let res = obj instanceof Array ? [] : {};
  for (const [k, v] of Object.entries(obj)) {
    //递归调用实现深拷贝
    res[k] = typeof v == "object" ? copy(v) : v;
  }
  return res;
}
let hd = copy(data);
// hd.user.name = "败军";
hd.arr.push("abc");
console.log(JSON.stringify(hd, null, 2));
console.log(JSON.stringify(data, null, 2));
